﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using GameLib.Gameplay.Scripting.Markups;

namespace GameLib.Gameplay.Scripting
{
	public class Script
	{
		public Script()
		{
			Sections = new List<Section>();
		}

		public void Load(ScriptReader reader)
		{
			while (reader.CurrentNodeType != ScriptReaderNodeType.ScriptEnd)
			{
				if (reader.CurrentNodeType != ScriptReaderNodeType.MarkupBegin || reader.MarkupName != ScriptMarkups.Section.Name)
					throw new Exception("There must only be 'Section'(s) under root of script");

				Section section = new Section();
				section.Load(reader);

				Sections.Add(section);
			}
		}

		protected List<Section> Sections { get; private set; }
	}
}
